package com.cs.study.homework._0206;

import java.util.Arrays;

public class Max {
    public static void main(String[] args) {
        int[] arr = new int[]{1, 23, 55, 6, 7, 15};
        System.out.println("原始数组：" + Arrays.toString(arr));
        System.out.println("最大值为" + getMax(arr));
    }
    public static int getMax(int... var){
        int max = var[0];
        for (int element: var) {
            if (element >= max) {
                max = element;
            }
        }
        return max;
    }
}
